using System;
using System.Collections.Generic;
using System.Text;
using DirectShowLib;
using System.IO;
namespace ConsolePlayer
{
	[Serializable]
	public class Mp3 : ISupport
	{
		public static string[] exts = { ".mp3" };
		#region ISupport Members

		public string[] GetSupportedFormat()
		{
			return exts;
		}

		public int RenderGraph(IFilterGraph2 graph, string fileName)
		{
			FileInfo info = new FileInfo(fileName);
			string ext = info.Extension;
			bool has = false;
			foreach (string s in exts)
			{
				if (s == ext)
				{
					has = true;
					break;
				}
			}

			if (!has)
				return -1;

			//just render file

			IMediaControl mediaControl = graph as IMediaControl;
			if( mediaControl == null ) return -1;

			return mediaControl.RenderFile(fileName);
		}

		#endregion
	}
}
